<template>
    <bi-input v-model="value"  :loading="loading" :after-width="100" readonly  placeholder="请选择文件" >
        <template #after>
            <bi-button type="light" icon="fa-folder-open" @click="openDialog" >选择文件</bi-button>
        </template>
    </bi-input>
</template>

<script>
import fieldMixin from '../../bi-plug/fieldMixin.js';
export default{
    mixins:[fieldMixin],
    data(){
        return {

            loading:false
        }
    },
    props:{
        root:{
            type:String,
            default:''
        },
        folder:{
            type:Boolean,
            default:false
        },
        file:{
            type:Boolean,
            default:true
        },
        ext:{
            type:String,
            default:'*'
        }
    },
    methods:{
        openDialog(){
            if (this.root==''){
                this.$alert('配置错误');
                return;
            }

            this.$admin.systemFile((value)=>{
               
               
                this.value = '/' + value.file;
                
                
            },{
                title:'选择文件',
                root:this.root,
                ext:this.ext,
                file:this.file,
                folder:this.folder
            });
        }
    },
    mounted(){

    } 
}
</script>